package edu.ccut.saturn.studio.export.createhtml;

import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.eclipse.core.resources.IProject;
import org.w3c.dom.Document;

import edu.ccut.saturn.studio.authority.model.AuthorityModel;
import edu.ccut.saturn.studio.authority.model.Resource;
import edu.ccut.saturn.studio.core.exception.XMLException;
import edu.ccut.saturn.studio.core.util.eclipse.SaturnProjectUtil;
import edu.ccut.saturn.studio.core.util.freemaker.FreemarkerUtils;
import edu.ccut.saturn.studio.core.util.xml.SaturnW3CUtil;
import edu.ccut.saturn.studio.export.model.Action;
import edu.ccut.saturn.studio.export.model.Comp;
import edu.ccut.saturn.studio.export.model.Logic;
import edu.ccut.saturn.studio.export.model.Saturndata;
import edu.ccut.saturn.studio.export.model.Validate;
import edu.ccut.saturn.studio.export.model.Wfg;
import edu.ccut.saturn.studio.menuitem.model.Menu;
import edu.ccut.saturn.studio.menuitem.model.MenuItem;
import edu.ccut.saturn.studio.menuitem.model.MenuItemModel;

/**
 * 项目开发文档具体实现类
 * 
 * @author 赵新峰
 * @author 杨艳斌
 * @version 1.1 2009.12.11
 */

public class AnalyseProject {

	protected static final String SEPARATOR = File.separator;

	private static final String CLASSPATH_IS_TYPE_SRC = "src";
	private static final String SATURN_FOLDER_MODULE = "module";
	private static int iterators = 0;
	private static StringBuffer tempcontent = new StringBuffer();
	private static String temppath = "";
	private static String rootpath = "";
	private static int urls = 0;
	private static int flags = 1;
	private static String order = "";
	private static String tempvar = "";
	private static String projectname = "";
	private static String modulename = "";
	private static String foldername = "";
	
	
	/**
	 * 创建文档生成的目录结构
	 * 
	 * @param project,savePath
	 * @return
	 */
	public static void CreateProjectFolderrDirectory(IProject project,
			String savePath) {

		// 创建工程名文件夹
		String projectFolderPath = savePath + File.separator
				+ project.getName();
		createFolder(projectFolderPath);

		Set<String> srcs = SaturnProjectUtil.getClassPathsByType(project, CLASSPATH_IS_TYPE_SRC);

		for (String src : srcs) {
			for (File fileMoudle : new File(src).listFiles()) {

				if (fileMoudle.isDirectory()) {
					if (SATURN_FOLDER_MODULE.equals(SaturnProjectUtil.saturnFileType(fileMoudle))) {

						// 创建模块文件夹
						String moudleFolderPath = projectFolderPath + SEPARATOR
								+ fileMoudle.getName();
						createFolder(moudleFolderPath);

						for (File fileFloder : fileMoudle.listFiles()) {
							if (fileFloder.isDirectory()
									&& SaturnProjectUtil.isSaturnFloderType(SaturnProjectUtil.saturnFileType(fileFloder))) {

								// 创建构件文件夹文件夹
								String compontentfolderFolderPath = moudleFolderPath
										+ SEPARATOR + fileFloder.getName();
								createFolder(compontentfolderFolderPath);

								File[] files = fileFloder.listFiles();

								for (File file : files) {
									if (file.isFile()
											&& SaturnProjectUtil.isSaturnCompontent(file.getName())) {

										// 创建构件文件夹
										String compontentFolderPath = compontentfolderFolderPath
												+ SEPARATOR
												+ file.getName().replace(".",
														"-");
										createFolder(compontentFolderPath);
									}
								}
							}
						}
					}
				}
			}
		}
	}
	
	/**
	 * 创建html文档
	 * 
	 * @param project,savePath
	 * @return
	 * @throws XMLException
	 */
	
	public static void CreateProjectHtml(IProject project, String savePath)
			throws XMLException {
		
		String projectFolderPath = savePath + File.separator
				+ project.getName();
		projectname = project.getName();

		Set<String> srcs = SaturnProjectUtil.getClassPathsByType(project, CLASSPATH_IS_TYPE_SRC);

		List<HtmlBaseElementVO> compontentesMoudleUrles = new ArrayList<HtmlBaseElementVO>();

		for (String src : srcs) {

			for (File fileMoudle : new File(src).listFiles()) {

				if (fileMoudle.isDirectory()) {
					if (SATURN_FOLDER_MODULE.equals(SaturnProjectUtil.saturnFileType(fileMoudle))) {

						List<HtmlBaseElementVO> compontentesFolderUrles = new ArrayList<HtmlBaseElementVO>();
						HtmlBaseElementVO HtmlModleVO = new HtmlBaseElementVO();     //存放html文档链接信息的对象
						String moudleFolderPath = projectFolderPath + SEPARATOR
								+ fileMoudle.getName();
						modulename = fileMoudle.getName();

						for (File fileFloder : fileMoudle.listFiles()) {
							if (fileFloder.isDirectory()
									&& SaturnProjectUtil.isSaturnFloderType(SaturnProjectUtil.saturnFileType(fileFloder))) {

								List<HtmlBaseElementVO> compontentesUrles = new ArrayList<HtmlBaseElementVO>();
								HtmlBaseElementVO HtmlFloderVO = new HtmlBaseElementVO();
								String compontentfolderFolderPath = moudleFolderPath
										+ SEPARATOR + fileFloder.getName();
								foldername = fileFloder.getName();

								File[] files = fileFloder.listFiles();

								for (File file : files) {
									if (file.isFile()
											&& SaturnProjectUtil.isSaturnCompontent(file.getName())) {

										HtmlBaseElementVO HtmlVO = new HtmlBaseElementVO();
										String compontentFolderPath = compontentfolderFolderPath
												+ SEPARATOR
												+ file.getName().replace(".",
														"-");
										createFolder(compontentFolderPath);
										String compontentDescription =  createComponentHtml(file,
												compontentFolderPath);
										String compontentHtmlPath = file
												.getName().replace(".", "-")
												+ "/"
												+ file.getName().replace(".",
														"-") + ".html";
										HtmlVO.setHtmlUrl(compontentHtmlPath);
										HtmlVO.setHtmlName(file.getName());
										HtmlVO.setDescription(compontentDescription);
										compontentesUrles.add(HtmlVO);

										if (!file.getName().endsWith("jsp")) {
										}
									}
								}
								String FoloderHtmlSavePath = compontentfolderFolderPath      //创建构件html文档
										+ File.separator
										+ fileFloder.getName()
										+ ".html";
								String FoloderHtmlTemplateUrl;
								Map<String, Object> values = new HashMap<String, Object>();
								values.put("compontentFolder",
										compontentesUrles);

								if (SaturnProjectUtil.saturnFileType(fileFloder).equals("web")) {       //创建web构件文件夹html文档
									FoloderHtmlTemplateUrl = "/template/export/jspFoleder";
									FreemarkerUtils.writeTemplateToFile(
											FoloderHtmlTemplateUrl, values,
											FoloderHtmlSavePath);
								} else {
									FoloderHtmlTemplateUrl = "/template/export/compontentFolder.ftl";
									FreemarkerUtils.writeTemplateToFile(
											FoloderHtmlTemplateUrl, values,
											FoloderHtmlSavePath);
								}
								HtmlFloderVO.setDescription(SaturnProjectUtil.readDescription(fileFloder));//创建构件文件夹html文档
								HtmlFloderVO.setHtmlUrl(fileFloder.getName()
										+ "/" + fileFloder.getName() + ".html");
								HtmlFloderVO.setHtmlName(fileFloder.getName());
								compontentesFolderUrles.add(HtmlFloderVO);

							}
						}
						Map<String, Object> values = new HashMap<String, Object>();      //创建模块文件夹html文档
						values.put("compontentFolder", compontentesFolderUrles);
						String modleHtmlTemplateUrl = "/template/export/compontentModle.ftl";
						String modleHtmlSavePath = moudleFolderPath
								+ File.separator + fileMoudle.getName()
								+ ".html";
						FreemarkerUtils
								.writeTemplateToFile(modleHtmlTemplateUrl,
										values, modleHtmlSavePath);
						HtmlModleVO.setDescription(SaturnProjectUtil.readDescription(fileMoudle));
						HtmlModleVO.setHtmlName(fileMoudle.getName());
						HtmlModleVO.setHtmlUrl(fileMoudle.getName() + "/"
								+ fileMoudle.getName() + ".html");
						compontentesMoudleUrles.add(HtmlModleVO);
					}
				}
				
				if (fileMoudle.getName().endsWith("authority.config")) {                 	//创建权限html文档
					createAuthorityHtml(fileMoudle, projectFolderPath);
				} else if (fileMoudle.getName().endsWith("menu.config")) {					//创建菜单html文档
					createMenuHmtl(fileMoudle, projectFolderPath);
				}
			}
			Map<String, Object> values = new HashMap<String, Object>();						//创建工程html文档
			values.put("compontentFolder", compontentesMoudleUrles);
			String porjectHtmlTemplateUrl = "/template/export/compontentPorject.ftl";
			String porjectHtmlSavePath = projectFolderPath + File.separator
					+ project.getName() + ".html";
			FreemarkerUtils.writeTemplateToFile(porjectHtmlTemplateUrl, values,
					porjectHtmlSavePath);
		}
	}

	/**
	 * 创建菜单配置文件html文档
	 * 
	 * @param file,projectFolderPath
	 * @return
	 * @throws XMLException
	 */
	private static void createMenuHmtl(File file, String projectFolderPath) throws XMLException {
		
		Document doc = SaturnW3CUtil.getDocument(file.getAbsolutePath());
		MenuItemModel menuModel = new MenuItemModel(doc);
		Menu menu = menuModel.getMenu();
		List<MenuItem> menuitems = menu.getChildren();
		Map<String, Object> values = new HashMap<String, Object>();
		Map<String, Object> indexvalues =  new HashMap<String, Object>();
		StringBuffer tempcontents = new StringBuffer();
		
		tempcontents = tempcontents.append(appendTempContent(menuitems, projectFolderPath));//创建菜单树的根节点
		tempcontent = tempcontents;
		rootpath = projectFolderPath + File.separator + 
						"menu/" + menuitems.get(0).getLabel();
		
		appendContent(menuitems.get(0).getChildren(), projectFolderPath + File.separator 
				   + "menu/" + menuitems.get(0).getLabel(), menuitems.get(0).getLabel());
		values.put("content", tempcontent);
		
		
		String templateUrl = "/template/export/menuTree.ftl";
		FreemarkerUtils.writeTemplateToFile(templateUrl,
				values, projectFolderPath + File.separator 
						+ "menu/menuTree.html");
		
		String temptemplateUrl = "/template/export/attribute.ftl";
		FreemarkerUtils.writeTemplateToFile(temptemplateUrl,
				indexvalues, projectFolderPath + File.separator
						+ "menu/nodeAttribute.html");
		
		String indextemplateUrl = "/template/export/menu.ftl";
		FreemarkerUtils.writeTemplateToFile(indextemplateUrl,
				indexvalues, projectFolderPath + File.separator
						+ "menu.html");
	}
	
	/**
	 * 创建菜单配置文件菜单树的根节点
	 * 
	 * @param menuitems,projectFolderPath
	 * @return String
	 */
	private static String appendTempContent(List<MenuItem> menuitems,
			String projectFolderPath) {
		Map<String, Object> values = new HashMap<String, Object>();
		StringBuffer tempcontent = new StringBuffer();
		
		values.put("order", menuitems.get(0).getOrder());
		values.put("path", menuitems.get(0).getPath());
		values.put("name", menuitems.get(0).getLabel());
		
		String templateUrl = "/template/export/nodeAttribute.ftl";
		projectFolderPath = projectFolderPath + File.separator + "menu" 
								+ File.separator + menuitems.get(0).getLabel();
		createFolder(projectFolderPath);
		
		FreemarkerUtils.writeTemplateToFile(templateUrl,
				values, projectFolderPath + File.separator + menuitems.get(0).getLabel() + ".html");
		
		tempcontent.append("<li class='on'><span><a href='" + menuitems.get(0).getLabel() 
				+ "/" + menuitems.get(0).getLabel() 
				+ ".html' target='up'>" + menuitems.get(0).getLabel() 
				+ "</a></span> <br>"  + "\n");
		menuitems = menuitems.get(0).getChildren();
		
		tempcontent.append("<ul>");
		
		return tempcontent.toString();
	}
	
	/**
	 * 创建菜单配置文件菜单树除根节点的子节点
	 * 
	 * @param menuitems,projectFolderPath
	 * @return
	 */
	private static void appendContent(List<MenuItem> menuitems, String projectFolderPath, String rootname) {
		String truepath = "";
		String parentId = "";
		String relativeurl = "";
		int childrens = 1;
	
		for (MenuItem menuItem : menuitems) {
			Map<String, Object> values = new HashMap<String, Object>();
			int temporder = 0;
			String[] newarray = new String[10];
			newarray = tempvar.split("/");
			String label;
			
			values.put("order", menuItem.getOrder());
			values.put("path", menuItem.getPath());
			values.put("name", menuItem.getLabel());
			String templateUrl = "/template/export/nodeAttribute.ftl";
				
			if (!"".equals(order)) {
				temporder = Integer.parseInt(order) + 1;
				order = "";
			}
			//取得该节点的相对路径
			if (parentId.equals(menuItem.getParentId()) && tempvar.length() != 0 
					&& !menuItem.getParentId().equals("1")) {
				
				for (int i = 1; i < newarray.length  - 1; i ++) {
					temppath = temppath + "/" + newarray[i];
				}
			} else if (temporder == Integer.parseInt((menuItem.getOrder()))) {
				int templength = 0;
				
				if (flags == 1) {
					templength = 1;
				} else {
					templength = flags;
				}
				for (int i = 1; i < newarray.length - templength - 1; i ++) {
					temppath = temppath + "/" + newarray[i];
				}
			}
			
			truepath = projectFolderPath + temppath + File.separator + menuItem.getLabel();
			createFolder(truepath);
			
			relativeurl = temppath + "/" + menuItem.getLabel();
			temppath = temppath + "/" + menuItem.getLabel();
			FreemarkerUtils.writeTemplateToFile(templateUrl,
					values, truepath + File.separator + menuItem.getLabel() + "-" + 
					menuItem.getOrder() + ".html");	   //创建该节点的html文档
			
			if (menuItem.getChildren().size() != 0) {								//添加菜单树上的加减图标
				label = "on";
			} else {
				label = "off";
			}
			tempcontent.append("\t" + "<li class='" + label + "'><span><a href='"  + rootname 
						+ relativeurl  + "/" + menuItem.getLabel() + "-" 
						+ menuItem.getOrder()+ ".html' target='up'>" 
						+ menuItem.getLabel() + "</a></span> <br>"  + "\n");
			
			if (menuItem.getChildren().size() != 0) {								//该子节点还有自己点
				menuitems = menuItem.getChildren();
				childrens++;
				urls++;
				iterators += 1;
				tempcontent.append("\t" + "\t" + "\t" + "<ul>");
				appendContent(menuItem.getChildren(), rootpath, rootname);		//递归调用该方法以创建子节点的子节点
			} else if (Integer.parseInt(menuItem.getOrder()) 
						== (menuitems.size())) {					//该子节点是其父节点的最后一个子节点
				tempvar = temppath;
				
				if (Integer.parseInt(menuItem.getParent().getOrder()) == 	//该子节点的父节点是其父节点的最后一个子节点
						menuItem.getParent().getParent().getChildren().size()) {
					tempcontent.append("</ul>" + "\n" + "\t" + "\t" + "\t" + "</ul>");
					flags ++; 
				} else {
					order = menuItem.getParent().getOrder();
					tempcontent.append("\t" + "\t" + "\t" + "</ul>"  + "\n");
					flags = 1;
				}
				temppath = "";
				iterators += 1;
				parentId = menuItem.getParentId();
				urls = 0;
			} else {
				iterators += 1;
				parentId = menuItem.getParentId();
				tempvar = temppath;
				temppath = "";
			}
		}
	}
	
	/**
	 * 创建权限html文档
	 * 
	 * @param file,projectFolderPath
	 * @return
	 * @throws XMLException
	 */
	private static void createAuthorityHtml(File file, String projectFolderPath) throws XMLException {
		
		Document doc = SaturnW3CUtil.getDocument(file.getAbsolutePath());
		AuthorityModel authorityModel = new AuthorityModel(doc);
		List<Resource> resouces = authorityModel.getResources();
		Map<String, Object> Values = new HashMap<String, Object>();
		
		Values.put("resouces", resouces);
		String templateUrl = "/template/export/authority.ftl";
		FreemarkerUtils.writeTemplateToFile(templateUrl,
				Values, projectFolderPath + File.separator + "authority.html");
	}
	
	/**
	 * 添加工程菜单树
	 * 
	 * @param file,projectFolderPath
	 * @return
	 * @throws XMLException
	 */
	public static String CreateProjectTree(IProject project,
										String savePath) throws XMLException {

		Set<String> srcs = SaturnProjectUtil.getClassPathsByType(project, CLASSPATH_IS_TYPE_SRC);
		int times = 0;

		StringBuffer content = new StringBuffer();
		content.append("\t" + "\t" + "\t" + "\t" + "<li class='li1'><span><a href=");
		content.append(project.getName() + "/" + project.getName() + ".html");
		content.append(" target='right'>");
		content.append(project.getName());
		content.append("</a></span> <br>" + "\n");
		content.append("\t" + "\t" + "\t" + "\t" + "\t" + "<ul>" + "\n");

		for (String src : srcs) {
			
			for (File fileMoudle : new File(src).listFiles()) {
				int length = (new File(src).listFiles()).length; 
				times++;
				if (fileMoudle.isDirectory()) {
					if (SATURN_FOLDER_MODULE.equals(SaturnProjectUtil.saturnFileType(fileMoudle))) {

						content.append("\t" + "\t" + "\t" + "\t" + "\t" + "\t"
								+ "<li class='li2'><div style='width:300px' style=" +
										"'margin-left:-10px;'><div class='line'>- - - -" +
										"</div><span><a href=");
						content.append(project.getName() + "/"  + fileMoudle.getName() 
								+ "/" + fileMoudle.getName() + ".html");
						content.append(" target='right'>");
						content.append(fileMoudle.getName());
						content.append("</a></span> <br>" + "\n");
						content.append("\t" + "\t" + "\t" + "\t" + "\t" + "\t"
								+ "\t" + "<ul>" + "\n");
						for (File fileFloder : fileMoudle.listFiles()) {
							if (fileFloder.isDirectory()
									&& SaturnProjectUtil.isSaturnFloderType(SaturnProjectUtil.saturnFileType(fileFloder))) {

								// tree 文件夹目录
								content.append("\t" + "\t" + "\t" + "\t" + "\t"
										+ "\t" + "\t" + "\t"
										+ "<li class='leaf " + SaturnProjectUtil.saturnFileType(fileFloder) + "_folder'>"); 
								content.append("<div style='width:300px' style=" +
										"'margin-left:-10px;'><div class='line'>- - - -" +
										"</div><span> <a href=");
								content.append(project.getName() + "/" 
										+ fileMoudle.getName() + "/"
										+ fileFloder.getName() + "/"
										+ fileFloder.getName() + ".html");
								content.append(" target='right'>");
								content.append(fileFloder.getName());
								content.append("</a></span> <br>" + "\n");
								content.append("\t" + "\t" + "\t" + "\t" + "\t"
										+ "\t" + "\t" + "\t" + "\t" + "<ul>"
										+ "\n");
								File[] files = fileFloder.listFiles();

								for (File file : files) {
									if (file.isFile()
											&& SaturnProjectUtil.isSaturnCompontent(file.getName())) {

										if (!file.getName().endsWith("jsp")) {

											content.append("\t" + "\t" + "\t"
													+ "\t" + "\t" + "\t" + "\t"
													+ "\t" + "\t" + "\t"
													+ "	<li class='leaf " + SaturnProjectUtil.saturnFileType(fileFloder) + "'>" 
													+ "<div style='width:300px' style=" 
													+ "'margin-left:-10px;'><div class='line'>- - - -" 
													+ "</div><span><a href=");
											content.append(project.getName() + "/" 
													+ fileMoudle.getName()+ "/" 
													+ fileFloder.getName()+ "/"
													+ file.getName().replace(".","-")+ "/"
													+ file.getName().replace(".","-")	+ ".html");
											content.append(" target='right'>");
											content.append(file.getName() + "</a>"); 
											content.append(	"</span> <br>" + "\n");
										}
									}
								}
								content.append("\t" + "\t" + "\t" + "\t" + "\t"
										+ "\t" + "\t" + "\t" + "\t" + "</ul>"
										+ "\n");
							}
						}
						
						content.append("\t" + "\t" + "\t" + "\t" + "\t" + "\t"
								+ "\t" + "</ul>" + "\n");
						
						//在菜单树种添加权限和菜单配置文件
						if (times > length - 2) {
							content.append("\t" + "\t" + "\t" + "\t" + "\t" + "\t" +
									" <li class='li3'><div style='width:300px' " +
									" style='margin-left:-10px;'><div class='line'>- - - -" +
									" </div><span><a href="+ project.getName() + "/" 
									+ "authority.html target='right'>" 
									+ "authority</a></span> <br>" + "\n");
							content.append("\t" + "\t" + "\t" + "\t" + "\t" + "\t" +
									" <li class='li4'><div style='width:300px' " +
									" style='margin-left:-10px;'><div class='line'>- - - -" +
									" </div><span><a href=" + project.getName() + "/" 
									+ "menu.html target='right'>" 
									+ "menu</a></span> <br>" + "\n");
						}
					}
				}
			}
			content.append("\t" + "\t" + "\t" + "\t" + "\t" + "</ul>" + "\n");
		}
		return content.toString();
	}
	
	
	/**
	 * 创建相应的构件并返回该构件的描述信息
	 * 
	 * @param file compontentFolderPath
	 * @return String 
	 * 		   构件的描述信息
	 * @throws XMLException
	 */
	private static String createComponentHtml(File file,
								String compontentFolderPath) throws XMLException {
		
		String description = "";
		
		if (file.getName().endsWith("wf")) {
			description = Wfg.createComponentHtml(file, compontentFolderPath);
		} else if (file.getName().endsWith("component")) {
			description = Comp.createComponentHtml(file, compontentFolderPath);
		} else if (file.getName().endsWith("saturndata")) {
			description = Saturndata.createComponentHtml(file, compontentFolderPath);
		} else if (file.getName().endsWith("validate")) {
			description = Validate.createComponentHtml(file, compontentFolderPath);
		} else if (file.getName().endsWith("logic")) {
			description = Logic.createComponentHtml(file, compontentFolderPath, 
					projectname, modulename, foldername);
		} else if (file.getName().endsWith("action")) {
			description = Action.createComponentHtml(file, compontentFolderPath, 
					projectname, modulename, foldername);
		}
		
		return description;
	}
	
	/**
	 * 创建文件夹
	 * 
	 * @param folderPath
	 * 		  文件夹路径
	 * @return 
	 */
	private static void createFolder(String folderPath) {

		try {
			java.io.File myFilePath = new java.io.File(folderPath);
			if (!myFilePath.exists()) {
				myFilePath.mkdirs();
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	/**
	 * 创建多工程导出时的首页、导航树和工程列表
	 * 
	 * @param type
	 * @return 
	 */
	public static void CreateProjectsHtml(String savePath,
							List<IProject> projects, StringBuffer content) {
		
		List<HtmlBaseElementVO> urls = new ArrayList<HtmlBaseElementVO>();
		
		for (IProject project : projects) {
			HtmlBaseElementVO url = new HtmlBaseElementVO();
			url.setHtmlUrl(project.getName() 
							+ "/" + project.getName() + ".html");
			url.setHtmlName(project.getName());
			urls.add(url);
		}
		
		Map<String, Object> treeValues = new HashMap<String, Object>();
		treeValues.put("content", content.toString());
		String treeTemplateUrl = "/template/export/projectsTree.ftl";
		FreemarkerUtils.writeTemplateToFile(treeTemplateUrl, treeValues,
				savePath + File.separator + "projectsTree.html");						//创建导航树
		
		Map<String, Object> projectsValues = new HashMap<String, Object>();
		projectsValues.put("projects", urls);
		String projectsUrl = "/template/export/projects.ftl";
		FreemarkerUtils.writeTemplateToFile(projectsUrl, projectsValues,
				savePath + File.separator + "projects.html");							//创建工程列表
		
		Map<String, Object> projectsValuses = new HashMap<String, Object>();
		String projectsTreeIndexUrl = "/template/export/projectsIndex.ftl";
		FreemarkerUtils.writeTemplateToFile(projectsTreeIndexUrl, projectsValuses,
				savePath + File.separator + "index.html");								//创建首页
		
	}
}
